package com.sayimo.maker.mall.goods.dao.impl;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import com.sayimo.framework.database.mybatis.AbstractMybatisBaseDao;
import com.sayimo.framework.exception.DaoException;
import com.sayimo.maker.mall.goods.dao.GoodsNormsStockInterfaceDao;
import com.sayimo.maker.mall.goods.vo.GoodsNormsStock;



/**
 * @Copyright (C)  广东省尚一互联网有限公司
 * @Project: schoolmallapi
 * @ClassName: GoodsNormsStockInterfaceImplDao
 * @Description: 
 * @author:	wangyang
 * @date:	日期：2016年7月15日  时间：下午4:50:25
 * @version 2.0.0
 */
@Repository(value="goodsNormsStockInterfaceDao")
public class GoodsNormsStockInterfaceImplDao extends AbstractMybatisBaseDao<GoodsNormsStock> implements GoodsNormsStockInterfaceDao {
	private static Logger logger = LogManager
			.getLogger(GoodsNormsStockInterfaceImplDao.class.getName());

	/** 
	* @Title: selectGoodsNormsStock 
	* @Description: 查询
	* @param stockId
	* @return
	* @return GoodsNormsStock
	* @throws 
	*/
	@Override
	public GoodsNormsStock selectGoodsNormsStock(Integer stockId)
			throws DaoException {
		GoodsNormsStock goodsNormsStock=new GoodsNormsStock();
		try {
			goodsNormsStock=this.mybatisInterfaceBaseDao.get("com.sayimo.maker.mall.goods.dao.GoodsNormsStockDao.selectGoodsNormsStock", stockId);
		} catch (DaoException e) {
			logger.debug(e);
			throw new DaoException(e.getMessage());
		}
		
		return goodsNormsStock;
	}

	/** 
	* @Title: updateGoodsNormsStock 
	* @Description: 修改库存
	* @param goodsNormsStock
	* @return void
	* @throws 
	*/
	@Override
	public int updateGoodsNormsStock(GoodsNormsStock goodsNormsStock)
			throws DaoException {
		try {
			return this.mybatisInterfaceBaseDao.update("com.sayimo.maker.mall.goods.dao.GoodsNormsStockDao.updateGoodsNormsStock", goodsNormsStock);
		} catch (DaoException e) {
			logger.debug(e);
			throw new DaoException(e.getMessage());
		}
		
	}

	/** 
	* @Title: updateReturnGroupBuyNumById 
	* @Description: 取消返还团购活动商品数量根据订单id
	* @param id
	* @return Integer
	* @throws 
	*/
	@Override
	public Integer updateReturnGroupBuyNumById(Integer orderId)
			throws DaoException {
		return this.mybatisInterfaceBaseDao.update("com.sayimo.maker.mall.goods.dao.GoodsNormsStockDao.updateReturnGroupBuyNumById", orderId);
	}
	
}
